home *** CD-ROM | disk | FTP | other *** search
/ Hobby PC 32 / Hobby PC 32.iso / extras / WIN31 / DATA.Z / DC3LOCAL.INC < prev    next >
Text File  |  1995-12-04  |  19KB  |  576 lines

  1. '----------------------------------------------------------------
  2. '- more specialized little functions to make our lives easier.
  3. '- John Alspaugh 10OCT94
  4. '- Copyright 1993-1995 Virtus Corporation.  All Rights Reserved.
  5. '-
  6. '- Note that this must be included after MSDETECT.INC and SETUPAPI.INC
  7. '-
  8. '----------------------------------------------------------------
  9. '-------------------------------------------------------------------
  10. '' VL_* functions are those with local variable references.
  11. '' V* functions can stand alone.
  12. '-------------------------------------------------------------------
  13.  
  14. '' define one of these:  PROGRAM or LIBRARY.  It defines the dialog
  15. '' IDs and stuff.
  16. '$DEFINE PROGRAM
  17.  
  18. '$ifdef PROGRAM
  19. '$DEFINE OPTION  ''if OPTION, then give the user the choice of a custom install.
  20. ''''$DEFINE SERIAL  ''no serial, no work.
  21. ''''$DEFINE CHATTER  '' turns on the little blurby messages during the install
  22. '''$ELSE IF LIBRARY
  23. '$endif 'PROGRAM
  24.  
  25. '*******************************************************************
  26. ' consts for dialogs
  27. CONST MODWININI_DLG        = 7600
  28.  
  29.  
  30. '*******************************************************************
  31. ' declare all the functions up front.
  32. DECLARE SUB VL_Initialize
  33.  
  34. DECLARE SUB VL_InitDiskCosts
  35. DECLARE SUB VL_RecalcOptFiles (ftype%)
  36. DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
  37. DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
  38. DECLARE SUB VL_SetupBillboards
  39.  
  40. DECLARE SUB VL_InitDirNames
  41. DECLARE SUB VL_RecalcPath
  42. DECLARE SUB VL_AddOptFilesToCopyList (ftype%)
  43. DECLARE SUB VL_DoTheInstall
  44. DECLARE SUB VL_MakeTheAppIcons
  45. DECLARE SUB VL_ShowIconsOkay
  46. DECLARE FUNCTION VL_ShouldWeSerialize AS INTEGER
  47.  
  48. DECLARE SUB VL_InitReadmeFileNames
  49. DECLARE SUB VL_MakeTheReadmeIcons
  50.  
  51.  
  52. '*******************************************************************
  53. ' these are the global variable things.  They get used in lots of
  54. ' areas
  55. '' there should be one I* const for each checkbox in dialog #6200
  56. CONST IAPPFILES     = 1
  57. CONST ILIBRARIES    = 2
  58. CONST IMODELS        = 3
  59. CONST ITEXTURES     = 4
  60. CONST IBTEXTURES      = 5
  61. CONST N_CHECKBOXES  = 5 '' you get this from counting the number of
  62.                         '' checkboxes in dialog #6200
  63.  
  64. GLOBAL DESTDIRNAME$   '' the path of the destination directory
  65. GLOBAL PRODUCTNAME$     '' the real name of the product (like "Virtus VR")
  66. GLOBAL EXEFILENAME$     '' the name of the exe (like VIRTUSVR.EXE)
  67. GLOBAL PROGRAMGROUP$    '' name we want the group to have in the Program Manager
  68. GLOBAL DATAFILEEXT$     '' file extension for the models (VVR, WLK)
  69. GLOBAL INFFILENAME$        '' name of the INF file
  70. GLOBAL DEFDIRNAME$        '' default directory name
  71. GLOBAL THEINIFILE$        '' name of the ini file we associate our extension in
  72. GLOBAL BACKUPINIFILE$    '' name we back the ini file up to
  73.  
  74. GLOBAL WINDRIVE$        '' windows drive (the windows dir is here)
  75. GLOBAL WINDIR$
  76. GLOBAL DIALOGDLL$        '' where the dialogs come from
  77.  
  78. ''DECLARE SUB VL_Initialize
  79.  
  80. '-------------------------------------------------------------------
  81. ' inits the variables specific to this installer.
  82. SUB VL_Initialize STATIC
  83.  
  84.     WINDIR$ = GetWindowsDir()
  85.     WINDRIVE$ = ucase$(MID$(WINDIR$, 1, 1))
  86.  
  87.     '' REPLACE ME!
  88.     PRODUCTNAME$ = "Key Design Center 3D"
  89.     EXEFILENAME$ = "DESIGN3D.EXE"
  90.     PROGRAMGROUP$ = "Key Design Center 3D"
  91.     DATAFILEEXT$ = "VVR"
  92.     INFFILENAME$ = "DESIGN3D.INF"
  93.     DEFDIRNAME$ = "DESIGN3D"
  94.     BACKUPINIFILE$ = "winini.dc3"
  95.     '' REPLACE ME!
  96.     DESTDIRNAME$ = WINDRIVE$ + ":\" + DEFDIRNAME$
  97.     THEINIFILE$ = "win.ini"
  98.     DIALOGDLL$ = "mscuistf.dll"
  99.  
  100. END SUB
  101.  
  102.  
  103. '*******************************************************************
  104. ' Variable and functions for the disk cost stuff.  There is one
  105. ' variable for each section in the dialog #6200.  Also related are
  106. ' the I* constants in the previous section
  107. ''CustInst list symbol names
  108. GLOBAL APPNEEDS$    'Application items need this much disk space
  109. GLOBAL LIBRARYNEEDS$  'Gallery items need
  110. GLOBAL MODELNEEDS$ 'Scene items need this much disk space
  111. GLOBAL TEXTURENEEDS$ 'Texture items need this much disk space
  112. GLOBAL BTEXTURENEEDS$ 'Texture items need this much disk space
  113. GLOBAL EXTRACOSTS$  'List of extra costs to add per drive. This is how much we're short.
  114.  
  115. ''DECLARE SUB VL_InitDiskCosts
  116. ''DECLARE SUB VL_RecalcOptFiles (ftype%)
  117. ''DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
  118. ''DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
  119.  
  120. '-------------------------------------------------------------------
  121. ' inits the variables specific to calculating the disk costs
  122. SUB VL_InitDiskCosts STATIC
  123.  
  124.     ''Disk cost list symbols
  125.     '' REPLACE ME!
  126.     APPNEEDS$   = "AppNeeds"
  127.     LIBRARYNEEDS$  = "LibraryNeeds"
  128.     MODELNEEDS$  = "ModelNeeds"
  129.     TEXTURENEEDS$  = "TextureNeeds"
  130.     BTEXTURENEEDS$  = "BTextureNeeds"
  131.     '' REPLACE ME!
  132.  
  133.     EXTRACOSTS$ = "ExtraCosts"
  134.     FOR i% = 1 TO 26 STEP 1
  135.         AddListItem APPNEEDS$, "0"
  136.         AddListItem LIBRARYNEEDS$, "0"
  137.         AddListItem MODELNEEDS$, "0"
  138.         AddListItem TEXTURENEEDS$, "0"
  139.         AddListItem BTEXTURENEEDS$, "0"
  140.  
  141.         AddListItem EXTRACOSTS$, "0"
  142.     NEXT i%
  143. END SUB
  144.  
  145. '-------------------------------------------------------------------
  146. ' calculates disk cost
  147. SUB VL_RecalcOptFiles (ftype%) STATIC
  148.     CursorSave% = ShowWaitCursor()
  149.     ClearCopyList
  150.     VL_AddOptFilesToCopyList ftype%
  151.  
  152.     fExtra% = 0
  153.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  154.  
  155.     IF ftype% = IAPPFILES THEN
  156. '$IFDEF PROGRAM
  157.         IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
  158.             ''Add extra cost to Windows drive for ini/progman, etc.
  159.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  160.             fExtra% = 1
  161.         END IF
  162. '$ENDIF 'PROGRAM
  163.         ListSym$ = APPNEEDS$
  164.     ELSEIF ftype% = ILIBRARIES THEN
  165.         ListSym$ = LIBRARYNEEDS$
  166.     ELSEIF ftype% = IMODELS THEN
  167.         ListSym$ = MODELNEEDS$
  168.     ELSEIF ftype% = ITEXTURES THEN
  169.         ListSym$ = TEXTURENEEDS$
  170.     ELSEIF ftype% = IBTEXTURES THEN
  171.         ListSym$ = BTEXTURENEEDS$
  172.     ELSE
  173.         ListSym$ = ""
  174.     END IF
  175.  
  176.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  177.  
  178.     cost& = 0
  179.     FOR i% = 1 TO 26 STEP 1
  180.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  181.     NEXT i%
  182.        ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  183.  
  184.     IF fExtra% THEN
  185.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  186.     END IF
  187.     RestoreCursor CursorSave%
  188.     ListSym$ = ""
  189. END SUB
  190.  
  191.  
  192.  
  193. '-------------------------------------------------------------------
  194. ' handles the custom install (dialog #6200) checkboxes.  Order is
  195. ' set in the dialog itself.
  196. FUNCTION VL_DoCheckItems(pItem$) STATIC AS INTEGER
  197.     IF pItem$ = "CHK1" THEN
  198.         VL_RecalcOptFiles IAPPFILES
  199.         ok% = 1
  200.     ELSEIF pItem$ = "CHK2" THEN
  201.         VL_RecalcOptFiles ILIBRARIES
  202.         ok% = 1
  203.     ELSEIF pItem$ = "CHK3" THEN
  204.         VL_RecalcOptFiles IMODELS
  205.         ok% = 1
  206.     ELSEIF pItem$ = "CHK4" THEN
  207.         VL_RecalcOptFiles ITEXTURES
  208.         ok% = 1
  209.     ELSEIF pItem$ = "CHK5" THEN
  210.         VL_RecalcOptFiles IBTEXTURES
  211.         ok% = 1
  212.     ELSE
  213.         ok% = 0
  214.     END IF
  215.  
  216.     VL_DoCheckItems = ok%
  217.  
  218. END FUNCTION
  219.  
  220.  
  221. '-------------------------------------------------------------------
  222. ' Calculates the cost of installing the items in the list by adding
  223. ' the cost associated with each of the items.
  224. FUNCTION VL_CalcDiskCost (pDrive$) STATIC AS LONG
  225. '$ifdef DEBUG
  226.     if pDrive$ = "" then
  227.         BadArgErr 1, "VL_CalcDiskCost", pDrive$
  228.     end if
  229. '$endif ''DEBUG
  230.     ndrive% = ASC(ucase$(pDrive$)) - ASC("A") + 1
  231.  
  232.     diskCost& = 0
  233.  
  234.     ''REPLACE ME BEGIN
  235.     diskCost& = diskCost& + VAL(GetListItem(APPNEEDS$, ndrive%))
  236.     diskCost& = diskCost& + VAL(GetListItem(LIBRARYNEEDS$, ndrive%))
  237.     diskCost& = diskCost& + VAL(GetListItem(MODELNEEDS$, ndrive%))
  238.     diskCost& = diskCost& + VAL(GetListItem(TEXTURENEEDS$, ndrive%))
  239.     diskCost& = diskCost& + VAL(GetListItem(BTEXTURENEEDS$, ndrive%))
  240.     ''REPLACE ME END
  241.  
  242.     VL_CalcDiskCost = diskCost&
  243.  
  244. END FUNCTION
  245.  
  246.  
  247.  
  248. SUB VL_SetupBillboards STATIC
  249.  
  250.     ClearBillboardList
  251.  
  252.     AddToBillboardList DIALOGDLL$, 110, "FModelessDlgProc", 40
  253.     AddToBillboardList DIALOGDLL$, 111, "FModelessDlgProc", 40
  254.     AddToBillboardList DIALOGDLL$, 112, "FModelessDlgProc", 40
  255.     AddToBillboardList DIALOGDLL$, 115, "FModelessDlgProc", 10
  256.     AddToBillboardList DIALOGDLL$, 113, "FModelessDlgProc", 40
  257.     AddToBillboardList DIALOGDLL$, 114, "FModel